﻿using System.Windows;
using System.Windows.Data;

namespace QueryBuilder.Controls
{
    /// <summary>
    /// 
    /// </summary>
    public class Visualizer
    {
        /// <summary>
        /// 
        /// </summary>
        public static readonly DependencyProperty BoundPropertyProperty = DependencyProperty.RegisterAttached(
           "BoundProperty", typeof(string), typeof(Visualizer), null);

        /// <summary>
        /// 
        /// </summary>
        public static readonly DependencyProperty ConverterProperty = DependencyProperty.RegisterAttached(
           "Converter", typeof(IValueConverter), typeof(Visualizer), null);


        /// <summary>
        /// Gets the bound property.
        /// </summary>
        /// <param name="dependecyObject">The dependecy object.</param>
        /// <returns></returns>
        public static string GetBoundProperty(DependencyObject dependecyObject)
        {
            return (string)dependecyObject.GetValue(BoundPropertyProperty);
        }


        /// <summary>
        /// Gets the converter.
        /// </summary>
        /// <param name="dependencyObject">The dependency object.</param>
        /// <returns></returns>
        public static IValueConverter GetConverter(DependencyObject dependencyObject)
        {
            return (IValueConverter)dependencyObject.GetValue(ConverterProperty);
        }

        /// <summary>
        /// Sets the bound property.
        /// </summary>
        /// <param name="dependencyObject">The dependency object.</param>
        /// <param name="value">The value.</param>
        public static void SetBoundProperty(DependencyObject dependencyObject, string value)
        {
            dependencyObject.SetValue(BoundPropertyProperty, value);
        }

        /// <summary>
        /// Sets the converter.
        /// </summary>
        /// <param name="dependencyObject">The dependency object.</param>
        /// <param name="value">The value.</param>
        public static void SetConverter(DependencyObject dependencyObject, IValueConverter value)
        {
            dependencyObject.SetValue(ConverterProperty, value);
        }



    }
}